//
//  YHContributeContainerVC.m
//  Catches
//
//  Created by jiangqiong on 2018/5/17.
//  Copyright © 2018年 solot. All rights reserved.
//

#import "YHContributeContainerVC.h"
#import "YHContributeTitleItem.h"
#define  SEARCH_TITLE @[@"全球", @"地区"]

#define SEARCH_VC_CLASS @[NSClassFromString(@"YHContributionWorldVC"), NSClassFromString(@"YHContributionAreaVC")]

@interface YHContributeContainerVC ()

@property (nonatomic , strong)UIImage * shadowImage;
@end

@implementation YHContributeContainerVC

- (instancetype)init {
    if (self = [super initWithViewControllerClasses:SEARCH_VC_CLASS andTheirTitles:SEARCH_TITLE]) {
        
        self.menuViewStyle = WMMenuViewStyleLine;
        self.titleColorSelected =  COLOR_WITH_HEX(0xf6f6f6);
        self.titleColorNormal = [UIColor grayColor];
        self.progressColor = COLOR_WITH_HEX(0xdddddd);
        self.topBarHeight = 50;
        self.titleFontName = @"PingFangSC-Medium";
        self.titleSizeNormal = self.titleSizeSelected = 18;
        self.menuView.scrollView.scrollEnabled = NO;
        self.pageAnimatable = NO;
        self.menuView.dataSource = self;
        
    }
    return self;
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configUI];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    UIImage *shadowImage = self.navigationController.navigationBar.shadowImage;
    if (!self.shadowImage) {
        self.shadowImage = shadowImage;
    }
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:COLOR_WITH_HEX(0xf6f6f6)] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:COLOR_WITH_HEX(0xffffff)] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:self.shadowImage];
}

-(void)configUI{
    self.navigationItem.title = @"贡献榜";
    self.menuView.backgroundColor = COLOR_WITH_HEX(0xf6f6f6);
    self.view.backgroundColor = COLOR_WITH_HEX(0xf6f6f6);
    UIView * line = [UIView new];
    line.backgroundColor = COLOR_WITH_HEX(0xf6f6f6);
    [self.menuView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
        make.bottom.offset(0);
    }];
    self.menuView.progressHeight = 3;
    
}

#pragma mark -代理

- (WMMenuItem *)menuView:(WMMenuView *)menu initialMenuItem:(WMMenuItem *)initialMenuItem atIndex:(NSInteger)index {
    YHContributeTitleItem * item = [YHContributeTitleItem new];
    return item;
}


@end
